﻿<!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993] for details.
// All other rights reserved.
-->

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    
    xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
    xmlns:inputToolkitPrimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Input.Toolkit"
    x:Class="System.Windows.Controls.Samples.RatingSample">
    
    <UserControl.Resources>
        <Style x:Key="RatingItemNetflixStyle" TargetType="inputToolkit:RatingItem">
            <Setter Property="BorderBrush" Value="#FF545454"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="inputToolkit:RatingItem">
                        <Grid Height="20" Width="20" Background="{TemplateBinding Background}">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverRatingItem" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverHighlight" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.36"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetName="MouseOverHighlight" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                                <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFFFFF"/>
                                            </ColorAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames  Storyboard.TargetName="MouseOverRatingItem" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.BlurRadius)">
                                                <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="4" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverRatingItem" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.ShadowDepth)">
                                                <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="1" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <ColorAnimationUsingKeyFrames Storyboard.TargetName="MouseOverRatingItem" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.Color)">
                                                <DiscreteColorKeyFrame KeyTime="00:00:00" Value="#FF3A3A3A" />
                                            </ColorAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Pressed">
                                        <Storyboard/>
                                    </VisualState>
                                    <VisualState x:Name="Disabled"/>
                                    <VisualState x:Name="ReadOnly"/>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualState x:Name="Focused">
                                        <Storyboard/>
                                    </VisualState>
                                    <VisualState x:Name="Unfocused"/>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="FillStates">
                                    <VisualState x:Name="Empty"/>
                                    <VisualState x:Name="Partial"/>
                                    <VisualState x:Name="Filled"/>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Border Background="#02FFFFFF" BorderThickness="0"/>
                            <Path x:Name="DefaultRatingItem" Fill="White" Stretch="Fill" StrokeLineJoin="Round" StrokeThickness="0.6" VerticalAlignment="Stretch" Opacity="1" Data="M15,0 L18.6,11.373603 L30,11.459046 L20.824955,18.573566 L24.270519,30 L15,23.023449 L5.7294912,30 L9.1750822,18.573566 L0,11.459046 L11.399999,11.373603 z" Stroke="#FF969696">
                                <Path.Effect>
                                    <DropShadowEffect Color="#FFC4C4C4" ShadowDepth="1"/>
                                </Path.Effect>
                            </Path>
                            <inputToolkitPrimitives:LinearClipper RatioVisible="{TemplateBinding DisplayValue}" ExpandDirection="Right">
                                <Path Fill="{TemplateBinding Foreground}" Stretch="Fill" Stroke="{x:Null}" StrokeLineJoin="Round" VerticalAlignment="Stretch" Opacity="1" Data="M15,0 L18.6,11.373603 L30,11.459046 L20.824955,18.573566 L24.270519,30 L15,23.023449 L5.7294912,30 L9.1750822,18.573566 L0,11.459046 L11.399999,11.373603 z"/>
                            </inputToolkitPrimitives:LinearClipper>
                            <Path x:Name="MouseOverRatingItem" Stretch="Fill" Stroke="{x:Null}" StrokeLineJoin="Round" VerticalAlignment="Stretch" Data="M15,0 L18.6,11.373603 L30,11.459046 L20.824955,18.573566 L24.270519,30 L15,23.023449 L5.7294912,30 L9.1750822,18.573566 L0,11.459046 L11.399999,11.373603 z" Fill="#FFFFCB00" Opacity="0">
                                <Path.Effect>
                                    <DropShadowEffect/>
                                </Path.Effect>
                            </Path>
                            <Path x:Name="MouseOverHighlight" Fill="#FFFFFFFF" Stretch="Fill" Stroke="{x:Null}" StrokeLineJoin="Round" VerticalAlignment="Stretch" Opacity="0" Data="M15,0 L18.6,11.373603 L30,11.459046 L20.824955,18.573566 L24.270519,30 L15,23.023449 L5.7294912,30 L9.1750822,18.573566 L0,11.459046 L11.399999,11.373603 z"/>
                            <Path x:Name="FocusRatingItem" Stretch="Fill" Stroke="#FF6DBDD1" StrokeLineJoin="Round" StrokeThickness="0.01" VerticalAlignment="Stretch" Opacity="0" Data="M15,0 L18.6,11.373603 L30,11.459046 L20.824955,18.573566 L24.270519,30 L15,23.023449 L5.7294912,30 L9.1750822,18.573566 L0,11.459046 L11.399999,11.373603 z"/>
                            <ContentPresenter x:Name="Content" Cursor="{TemplateBinding Cursor}" HorizontalAlignment="Left" Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
      
    <StackPanel>
    
        <!-- Default Style -->
        <ContentControl Content="Default Style" Style="{StaticResource Header}" />
        <inputToolkit:Rating x:Name="rating"  Value="0.65" ItemCount="5" HorizontalAlignment="Left">
            <inputToolkit:Rating.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
                </ItemsPanelTemplate>
            </inputToolkit:Rating.ItemsPanel>
        </inputToolkit:Rating>
        <Slider Minimum="0" Maximum="1" SmallChange="0.1" Margin="0,2,0,0" Value="{Binding Path=Value, ElementName=rating, Mode=TwoWay}" HorizontalAlignment="Left" Width="148"/>
        
        <!-- CONTENT TO ADD BACK -->
        
        
        <!-- NetFlix Style Sample -->
        <ContentControl Content="NetFlix Style" Style="{StaticResource Header}" />
        <Border Width="164" Padding="2" BorderBrush="#FFB30000" BorderThickness="1" Margin="0,2,0,0">
            <StackPanel Orientation="Vertical" Margin="0">
                <Button Margin="0" Content="Casablanca" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF0F5A9B"/>
                <Image Source="Images/Casablanca.jpg" Height="191" Margin="9,0"/>
                <inputToolkit:Rating x:Name="netflix" Value="0.65" ItemCount="5" ItemContainerStyle="{StaticResource RatingItemNetflixStyle}"  HorizontalAlignment="Center" BorderBrush="Black">
                    <inputToolkit:Rating.Foreground>
                        <RadialGradientBrush Center="0.449000000953674,0.128000006079674" GradientOrigin="0.646000027656555,-1.17299997806549" RadiusX="-0.74299997091293335" RadiusY="0.37799999117851257">
                            <GradientStop Color="#FFF70202" Offset="0.989"/>
                            <GradientStop Color="#FFF62C2C" Offset="0.817"/>
                            <GradientStop Color="#FFF60202" Offset="0.005"/>
                            <GradientStop Color="#FFFFA043" Offset="0.934"/>
                        </RadialGradientBrush>
                    </inputToolkit:Rating.Foreground>
                </inputToolkit:Rating>
                <Button Click="Button_Click"  Height="14" HorizontalAlignment="Center" Margin="0,5,0,0" VerticalAlignment="Center" FontSize="8" Foreground="#FF484848" Padding="3,1,3,3">
                    <StackPanel Orientation="Horizontal">
                        <Path Stretch="Fill" StrokeThickness="0.1" StrokeLineJoin="Round" Stroke="#FF000000" Fill="Red" Data="F1 M 328.514,227.5C 336.47,227.5 342.919,233.768 342.919,241.5C 342.919,249.232 336.47,255.5 328.514,255.5C 320.559,255.5 314.11,249.232 314.11,241.5C 314.11,233.768 320.559,227.5 328.514,227.5 Z M 328.514,229.862C 321.902,229.862 316.541,235.073 316.541,241.5C 316.541,244.397 317.63,247.047 319.432,249.084L 336.056,232.461C 333.997,230.836 331.373,229.862 328.514,229.862 Z M 328.514,253.138C 335.127,253.138 340.488,247.927 340.488,241.5C 340.488,238.603 339.399,235.953 337.597,233.916L 320.973,250.54C 323.031,252.164 325.656,253.138 328.514,253.138 Z " Height="8.1" HorizontalAlignment="Center" Width="8.333" VerticalAlignment="Center" Margin="0,1,3,0"/>
                        <TextBlock Height="23" Text="Not Interested" TextWrapping="Wrap" />
                    </StackPanel>
                </Button>
            </StackPanel>
        </Border>

    </StackPanel>
</UserControl>
